<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:h="http://java.sun.com/jsf/html">

    <div class="ui-g">
        <div class="ui-g-12"><h3><b>基础信息</b></h3></div>

        <div class="ui-g-1"><p:outputLabel for="name" value="名称"/></div>
        <div class="ui-g-4">
            <p:inputText id="name" value="#{memberRightsInfoBean.$.rights_name}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel for="title" value="标题"/></div>
        <div class="ui-g-4">
            <p:inputText id="title" value="#{memberRightsInfoBean.$.rights_title}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>


        <div class="ui-g-1"><p:outputLabel value="类型" for="type"/></div>
        <div class="ui-g-4">
            <p:selectOneRadio id="type" value="#{memberRightsInfoBean.$.type}" disabled="#{memberRightsInfoBean.isView()}">
                <f:selectItem itemLabel="Banner" itemValue="0" />
                <f:selectItem itemLabel="Icon" itemValue="1" />
            </p:selectOneRadio>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel for="platform" value="平台"/></div>
        <div class="ui-g-4">
            <p:selectManyButton id="platform" value="#{memberRightsInfoBean.$.platform_type}" disabled="#{memberRightsInfoBean.isView()}">
                <f:selectItem itemLabel="IOS" itemValue="0"/>
                <f:selectItem itemLabel="ANDROID" itemValue="1"/>
            </p:selectManyButton>
        </div>

        <div class="ui-g-1"><p:outputLabel value="所属组" for="classif"/></div>
        <div class="ui-g-4">
            <p:selectOneMenu id="classif" value="#{memberRightsInfoBean.$.classification_id}" disabled="#{memberRightsInfoBean.isView()}">
                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                <f:selectItems
                value="#{memberRightsInfoBean.classificationInfos}"
                var="dic"
                itemLabel="#{dic.classif_name}" itemValue="#{dic.id}"/>
            </p:selectOneMenu>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel for="title" value="排序"/></div>
        <div class="ui-g-4">
            <p:inputNumber id="sort" value="#{memberRightsInfoBean.$.sort}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>

        <div class="ui-g-1"><p:outputLabel value="在线时间"/></div>
        <div class="ui-g-4">
            <p:calendar id="rightsStartTime" disabled="#{memberRightsInfoBean.isView()}"
                        value="#{memberRightsInfoBean.$.start_time}"
                        styleClass="autoWidthCalendar"
                        locale="#{constants:get('LOCALE')}"
                        timeZone="#{constants:get('TIME_ZONE')}"
                        pattern="#{constants:get('DATETIME_FORMAT')}"
                        readonlyInput="true"/>
            <span>—</span>
            <p:calendar id="rightsEndTime" disabled="#{memberRightsInfoBean.isView()}"
                        value="#{memberRightsInfoBean.$.end_time}"
                        styleClass="autoWidthCalendar"
                        locale="#{constants:get('LOCALE')}"
                        timeZone="#{constants:get('TIME_ZONE')}"
                        pattern="#{constants:get('DATETIME_FORMAT')}"
                        readonlyInput="true"/>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel value="版本号"/></div>
        <div class="ui-g-4">
            <p:inputNumber inputStyle="width: 47%" id="min_version" value="#{memberRightsInfoBean.$.min_version}" disabled="#{memberRightsInfoBean.isView()}" />
            <span>—</span>
            <p:inputNumber inputStyle="width: 47%" id="max_version" value="#{memberRightsInfoBean.$.max_version}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>

        <div class="ui-g-1"><p:outputLabel value="备注" for="remark"/></div>
        <div class="ui-g-4">
            <p:inputText id="remark" value="#{memberRightsInfoBean.$.remark}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel value="是否上线" for="status"/></div>
        <div class="ui-g-4">
            <p:selectOneMenu id="status" value="#{memberRightsInfoBean.$.status}" disabled="#{memberRightsInfoBean.isView()}">
                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                <f:selectItems
                        value="#{memberRightsInfoBean.dictionaries[DictionaryCode.ONLINE_OFFLINE_STATUS]}"
                        var="dic"
                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
            </p:selectOneMenu>
        </div>

        <div class="ui-g-1"><p:outputLabel value="内容" for="rights_content"/></div>
        <div class="ui-g-4">
            <p:inputText id="rights_content" value="#{memberRightsInfoBean.$.rights_content}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel value="额外信息" for="extra_message"/></div>
        <div class="ui-g-4">
            <p:inputText id="extra_message" value="#{memberRightsInfoBean.$.extra_message}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>

        <div class="ui-g-1"><p:outputLabel for="userType" value="用户类型"/></div>
        <div class="ui-g-4">
            <p:selectManyButton id="userType" value="#{memberRightsInfoBean.$.user_type}" disabled="#{memberRightsInfoBean.isView()}">
                <f:selectItem itemLabel="新用户" itemValue="0"/>
                <f:selectItem itemLabel="老用户" itemValue="1"/>
            </p:selectManyButton>
        </div>
        <div class="ui-g-2"/>
        <div class="ui-g-1"><p:outputLabel value="按钮内容" for="btn"/></div>
        <div class="ui-g-4">
            <p:inputText id="btn" value="#{memberRightsInfoBean.$.btn_context}" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>
    </div>

    <div class="ui-g">
        <div class="ui-g-12"><h3><b>图片</b></h3></div>
        <div class="ui-g-1">
            <p:graphicImage url="#{memberRightsInfoBean.$.icon_url}" width="80"/>
        </div>
        <div class="ui-g-3">
            <p:fileUpload fileUploadListener="#{memberRightsInfoBean.onUploadRightsIcon}"
                          mode="advanced"
                          fileLimit="1"
                          auto="true"
                          fileLimitMessage="只能上传一个文件"
                          invalidFileMessage="不支持上传文件类型"
                          invalidSizeMessage="文件过大"
                          sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                          allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                          label="上传" update="@form" process="@form" disabled="#{memberRightsInfoBean.isView()}"/>
        </div>
    </div>
</ui:composition>